package com.kuaifawu.lwnlawyerclient.Lib;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.kuaifawu.lwnlawyerclient.Model.LWNModel_lawyerInfo;
import com.kuaifawu.lwnlawyerclient.R;
import com.lidroid.xutils.BitmapUtils;

/**
 * Created by zhangminglei on 14/12/31.
 */
public class LWNDataLoader {
    public static void LoadHeadView(View convertView, LWNModel_lawyerInfo lawyer) {

        TextView textView_level = null;
        TextView textView_name = null;
        CircularImage imageView_portrait = null;
        ImageView imageView_sign = null;

        textView_name = (TextView) convertView.findViewById(R.id.mainhead_name);
        textView_level = (TextView) convertView.findViewById(R.id.mainhead_level);
        imageView_portrait = (CircularImage) convertView.findViewById(R.id.mainhead_portrait);
        //imageView_sign = (ImageView) convertView.findViewById(R.id.mainhead_sign);

        textView_name.setText(lawyer.getRealname());
        textView_level.setText("LV." + lawyer.getString_class());

        BitmapUtils bitmapUtils = new BitmapUtils(convertView.getContext());
        bitmapUtils.configDefaultLoadingImage(R.drawable.qd_youtouxiang);//默认背景图片
        bitmapUtils.configDefaultLoadFailedImage(R.drawable.qd_youtouxiang);//加载失败图片
        bitmapUtils.display(imageView_portrait, lawyer.getHead_src());
        //imageView_portrait.setImageDrawable(lawyer.getHead_src());
        //imageView_sign.setImageDrawable(lawyer.getLabel());
    }

    public static void reloadHeadView(View convertView, LWNModel_lawyerInfo lawyer) {

        TextView textView_level = null;
        TextView textView_name = null;
        CircularImage imageView_portrait = null;
        ImageView imageView_sign = null;

        textView_name = (TextView) convertView.findViewById(R.id.mainhead_name);
        textView_level = (TextView) convertView.findViewById(R.id.mainhead_level);
        imageView_portrait = (CircularImage) convertView.findViewById(R.id.mainhead_portrait);
        //imageView_sign = (ImageView) convertView.findViewById(R.id.mainhead_sign);

        textView_name.setText(lawyer.getRealname());
        textView_level.setText("LV." + lawyer.getString_class());

        BitmapUtils bitmapUtils = new BitmapUtils(convertView.getContext());
        bitmapUtils.configDefaultLoadingImage(R.drawable.qd_youtouxiang);//默认背景图片
        bitmapUtils.configDefaultLoadFailedImage(R.drawable.qd_youtouxiang);//加载失败图片
        bitmapUtils.display(imageView_portrait, lawyer.getHead_src());
        //imageView_portrait.setImageDrawable(lawyer.getHead_src());
        //imageView_sign.setImageDrawable(lawyer.getLabel());
    }
}
